home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / warpcom.zip / TERM.CPP < prev    next >
C/C++ Source or Header  |  1991-01-25  |  1KB  |  32 lines

  1. #include <conio.h>
  2. #include <stdio.h>
  3. #include <process.h>
  4. #include <iostream.h>
  5. #include "warpcomm.hpp"
  6.  
  7. int main(void)
  8. {
  9.     char ch=0, ch2=0;
  10.     clrscr();
  11.     cout << "A simple terminal program for Warp-Comm (Ctrl-C to exit)\r\n\n";
  12.  
  13.     remote.open(2400, 4, 0x3F8, 2000, 2000);
  14.     // opens the com port at 2400 baud, IRQ 4, base address 3F8 (hex) with
  15.     // 2000 byte transmit and receive buffers
  16.  
  17.     while(ch != 3) {
  18.         if(kbhit()) {           // checks for a keypress
  19.             ch=getch();         // gets a keypress
  20.             remote << ch;       // sends a character to the com port
  21.         }
  22.         if(remote.char_waiting()) {
  23.         // checks to see if a character is waiting at the com port
  24.  
  25.             remote >> ch2;      // gets a character from the com port
  26.             putch(ch2);         // outputs the character onto the screen
  27.         }
  28.     }
  29.     remote.close();             // closes the com port
  30.     exit(0);                    // exits with errorlevel 0
  31. }
  32.